<?php
// +---------------------------------------------------------------------+
// | OneBase    | [ WE CAN DO IT JUST THINK ]                            |
// +---------------------------------------------------------------------+
// | Licensed   | http://www.apache.org/licenses/LICENSE-2.0 )           |
// +---------------------------------------------------------------------+
// | Author     | Bigotry <3162875@qq.com>                               |
// +---------------------------------------------------------------------+
// | Repository | https://gitee.com/Bigotry/OneBase                      |
// +---------------------------------------------------------------------+

namespace app\index\controller;

/**
 * 前端首页控制器
 */
class About extends IndexBase
{
    
    /**
     * 公司简介
     * @return type
     */
    public function aboutContent()
    {     
        $this->getAllColumn();
        
        $this->aboutCommon();
        
        $where['category_id'] = 2;
        
         //获取联系方式
        $this->assign('contact',$this->logicContact->getContactInfo());
        
        $this->assign('info',$this->logicArticle->getArticleInfo($where,'a.content,a.content_second,a.content_third'));
        
        return $this->fetch('about_content');
    }
    
    
    /**
     * 我们的文化
     * @return type
     */
    public function aboutCulture()
    {     
        $where['category_id'] = 7;
        
        $this->aboutCommon();
        
        $this->getAllColumn();
        
         //获取联系方式
        $this->assign('contact',$this->logicContact->getContactInfo());
        
        $this->assign('list',$this->logicArticle->getArticleList2($where,'a.content,a.name,a.describe,a.created_at,cover_id'));
        
        return $this->fetch('about_culture');
    }
    
    
    /**
     * 我们的客户
     * @return type
     */
    public function aboutCustomer()
    {     
        $where['category_id'] = 4;
        
        $this->aboutCommon();
        
        $this->getAllColumn();
        
         //获取联系方式
        $this->assign('contact',$this->logicContact->getContactInfo());
        
        $this->assign('info',$this->logicArticle->getArticleInfo($where,'a.name,a.name_en,a.content'));
        
        $this->assign('list', $this->logicCustomer->getAppCustomerList([],'logo_id'));
        
        return $this->fetch('about_customer');
    }
    
    
    /**
     * 我们的历史
     * @return type
     */
    public function aboutHistory()
    {     
        $where['a.category_id'] = 6;
        
        $n_where['a.category_id'] = 6;
        
        $this->aboutCommon();
        
        $this->getAllColumn();
        
        if(array_key_exists('id', $this->param)){
            
            $n_where['a.id'] = $this->param['id'];
        }
        
        $this->assign('list',$this->logicArticle->getArticleList($where,'a.id,a.name','sort Asc'));
        
        $this->assign('info',$this->logicArticle->getArticleInfo($n_where,'a.content,a.id'));
        
         //获取联系方式
        $this->assign('contact',$this->logicContact->getContactInfo());
        
        return $this->fetch('about_history');
    }
    
    
    /**
     * 我们的业绩
     * @return type
     */
    public function aboutResult()
    {     
        $where['category_id'] = 5;
        
        $this->aboutCommon();
        
        $this->getAllColumn();
        
        $info = $this->logicArticle->getArticleInfo($where,'a.name,a.name_en,a.content,a.content_second','sort');
        
        $info['content'] = !empty($info) && array_key_exists('content', $info)?html_entity_decode($info['content']):'';
        
        $info['content_second'] = !empty($info) && array_key_exists('content_second', $info)?html_entity_decode($info['content_second']):'';
        
        $this->assign('info',$info);
        
        $this->assign('list',$this->logicOurResult->getAppOurResultList());
        
         //获取联系方式
        $this->assign('contact',$this->logicContact->getContactInfo());
        
        return $this->fetch('about_result');
    }
    
    
    /**
     * 我们的咨询师
     * @return type
     */
    public function aboutTeacher()
    {     
        //获取咨询师描述文章
        $where['category_id'] = 3;
        
        $this->aboutCommon();
        
        $this->getAllColumn();
        
        $this->assign('info',$this->logicArticle->getArticleInfo($where,'a.name,a.name_en,a.content,a.content_second,a.content_third'));
        
        //获取咨询师列表
        $this->assign('list',$this->logicConsultant->getConsultantList([],'consultant_name,describe,photo_id'));
        
         //获取联系方式
        $this->assign('contact',$this->logicContact->getContactInfo());
        
        return $this->fetch('about_teacher');
    }
    
    
    /**
     * 关于我们通用方法
     */
    public function aboutCommon()
    {
        $this->assign('column_id',4);
    }
}
